package stack;

import java.util.EmptyStackException;
import java.util.Stack;

/**
 * Created on 2021/7/26 16:54
 *
 * @author shuguo
 */
public class StackExample {
    public static void main(String[] args) {
        stackArray();
    }

    static void stackArray() {
        StackArray stack = new StackArray();
        stack.push(1);
        stack.push(2);
        stack.push(3);
        stack.push(4);
        System.out.println(stack.toString());
        System.out.println(stack.peek());
        System.out.println(stack.pop());
        System.out.println(stack.toString());
        System.out.println(stack.pop());
        System.out.println(stack.toString());
        System.out.println(stack.pop());
        System.out.println(stack.toString());
        System.out.println(stack.pop());
        System.out.println(stack.toString());
    }
}
